package org.example.lottery_system.dao.mapper;

import org.apache.ibatis.annotations.*;
import org.example.lottery_system.dao.dataobject.PrizeDO;

import java.util.List;

@Mapper
public interface PrizeMapper {
    @Insert("insert into prize (name, image_url,price,description)" +
    "values (#(name),#(image_url),#(image_url),#(description) )")
    @Options(useGeneratedKeys = true,keyProperty = "id",keyColumn = "id")
    int insert(PrizeDO prizeDO);

    @Select("select count(1) from prize")
    int count();

    @Select("select * from prize order by id desc limit #{offset},#{pageSize}")
    List<PrizeDO> selectPrizeList(@Param("offset") Integer offset,@Param("pageSize") Integer currentPage);
}
